﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Crap4Net.UnitTests
{
    [TestFixture]
    public class ArgumentMatcherTests
    {
        [Test]
        public void IsMatching_DifferentSystemClasses_ReturnFalse()
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching("int", "String");
            Assert.IsFalse(actual);
        }

        [Test]
        public void IsMatching_DifferentUserClasses_ReturnFalse()
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching("Class1", "Class2");
            Assert.IsFalse(actual);
        }

        [Test]
        public void IsMatching_UserClassAndSystemClass_ReturnFalse()
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching("Class1", "String");
            Assert.IsFalse(actual);
        }


        [Test]
        public void IsMatching_SameUserClass_ReturnsTrue()
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching("Class1", "Class1");
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
         public void IsMatching_VariousStringFormats_ReturnsTrue( 
            [Values("string", "String","System.String")] string className1,
            [Values("string", "String")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
        public void IsMatching_VariousIntFormats_ReturnsTrue(
           [Values("int", "Int32", "int32", "System.Int32")] string className1,
           [Values("int", "Int32", "int32", "System.Int32")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
        public void IsMatching_VariousObjectsFormats_ReturnsTrue(
           [Values("object", "Object", "System.Object")] string className1,
           [Values("object", "Object", "System.Object")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
        public void IsMatching_VariousFloatsFormats_ReturnsTrue(
           [Values("float", "float32", "Single", "System.Single")] string className1,
           [Values("float", "float32", "Single", "System.Single")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
        public void IsMatching_VariousDoubleFormats_ReturnsTrue(
           [Values("double", "float64", "Double", "System.Double")] string className1,
           [Values("double", "float64", "Double", "System.Double")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

        [Test]
        [Combinatorial]
        public void IsMatching_VariousBooleanFormats_ReturnsTrue(
           [Values("bool", "boolean", "Boolean", "System.Boolean")] string className1,
           [Values("bool", "boolean", "Boolean", "System.Boolean")] string className2)
        {
            var target = new ArgumentMatcher();
            var actual = target.IsMatching(className1, className2);
            Assert.IsTrue(actual);
        }

    }
}
